package com.boot.unity.api.wx.controller;


import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;

import com.boot.unity.api.wx.service.WxWqpjService;
import com.sun.istack.internal.NotNull;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;


import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/wx/wqpj")
@Validated
public class WxWqpjController {
    private final Log logger = LogFactory.getLog(WxWqpjController.class);

    @Autowired
    private WxWqpjService wxWqpjService;

//    @PostMapping("/checkUserWq")
    @GetMapping("/checkUserWq")
    public Object checkUserWq(@NotNull String uid, String key){
        return wxWqpjService.checkUserWq(uid, key);
    }

    @GetMapping("/querywq")
    public Object querywq(){
        return wxWqpjService.querywq();
    }

    @GetMapping("/queryDetail")
    public Object queryDetail(String id){
        return wxWqpjService.queryDetail(id);
    }

    @GetMapping("/saveCoachEvalWq")
    public Object saveCoachEvalWq( String id,String wqid){
        return wxWqpjService.saveCoachEvalWq(id,wqid);
    }
    /**
     * 评价页面初始化是删除所有已保存的评价信息  train_coach_eval_wq
     * @param id
     * @return
     */
    @GetMapping("/clearWq")
    public Object clearWq(String id){
        return wxWqpjService.clearWq(id);
    }
    /**
     * 获取问卷的条数，用来判断评价是否全部选择
     * @param id
     * @return
     */
    @GetMapping("/countWq")
    public Object countWq(String id){
        return wxWqpjService.countWq(id);
    }
    @GetMapping("/updateStarRating")
    public Object updateStarRating(String id,String starRatinig){
        return wxWqpjService.updateStarRating(id,starRatinig);
    }

    @GetMapping("/updateContent")
    public Object updateContent(String id,String content,String star,String wq){
        return wxWqpjService.updateContent(id,content,star,wq);

    }
}
